package cn.itcast.web05.request;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class RequestIncludedServlet
 */
public class RequestIncludedServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public RequestIncludedServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
	    // 1、获取输出字符流对象
	    PrintWriter out = response.getWriter();
	    // 2、输出一段中文
	    out.print("计算机科学与信息技术学院<br>");
	    out.print("request URI:" + request.getRequestURI() + "<br>");
	    out.print("拼接 para:" + request.getQueryString() + "<br>");
	    // 获取请求的参数：
	    out.print("getParameter:" + request.getParameter("p") + "<br>");
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
